<?php
if($user['loai'] == 1):
	$ho_ten 		= array('id'=>'ho_ten', 'class'=>'form-control', 'name'=>'ho_ten', 'value'=> set_value('ho_ten')?set_value('ho_ten'):$hoso->ho_ten,'type'=>'text','required'=>'');
	$ngay_sinh 	= array('id'=>'ngay_sinh', 'class'=>'form-control datepicker text-right', 'name'=>'ngay_sinh', 'value'=> set_value('ngay_sinh')?set_value('ngay_sinh'):date("d/m/Y", strtotime($hoso->ngay_sinh)),'required'=>'','autocomplete'=>'off');
	$hon_nhan 	= array('0'=>'Độc thân','1'=>'Đã kết hôn');
	$gioi_tinh 	= array('0'=>'Nữ','1'=>'Nam');
	$dich_vu 	= array('1'=>'Model ảnh','2'=>'Model Catwalk','3'=>'Sự kiện / Hội nghị / Triển lãm','4'=>'Mẫu ảnh bikini / nội y / đầm ngủ','5'=>'PG Tiệc/ Du lịch');	
	$di_dong1 	= array('id'=>'di_dong1', 'class'=>'form-control', 'name'=>'di_dong1', 'value'=> set_value('di_dong1')?set_value('di_dong1'):$hoso->di_dong1,'required'=>'');
	$di_dong2 	= array('id'=>'di_dong2', 'class'=>'form-control', 'name'=>'di_dong2', 'value'=> set_value('di_dong2')?set_value('di_dong2'):$hoso->di_dong2);
	$can_nang 	= array('id'=>'can_nang', 'class'=>'form-control text-right', 'name'=>'can_nang', 'value'=> set_value('can_nang')?set_value('can_nang'):$hoso->can_nang,'maxlength'=>2,'style'=>'width:60px;display:inline-block;','required'=>'');
	$chieu_cao_m= array('id'=>'chieu_cao_m', 'class'=>'form-control text-right', 'name'=>'chieu_cao_m', 'value'=> set_value('chieu_cao_m')?set_value('chieu_cao_m'):$hoso->chieu_cao_m,'maxlength'=>2,'style'=>'width:60px;display:inline-block;','required'=>'');
	$chieu_cao_cm= array('id'=>'chieu_cao_cm', 'class'=>'form-control text-right', 'name'=>'chieu_cao_cm', 'value'=> set_value('chieu_cao_cm')?set_value('chieu_cao_cm'):$hoso->chieu_cao_cm,'maxlength'=>2,'style'=>'width:60px;display:inline-block;','required'=>'');
	$vong_1 		= array('id'=>'vong_1', 'class'=>'text-right form-control', 'name'=>'vong_1', 'value'=> set_value('vong_1')?set_value('vong_1'):$hoso->vong1,'maxlength'=>2,'style'=>'width:80px;display:inline-block;','required'=>'');
	$vong_2 		= array('id'=>'vong_2', 'class'=>'text-right form-control', 'name'=>'vong_2', 'value'=> set_value('vong_2')?set_value('vong_2'):$hoso->vong2,'maxlength'=>2,'style'=>'width:80px;display:inline-block;','required'=>'');
	$vong_3 		= array('id'=>'vong_3', 'class'=>'text-right form-control', 'name'=>'vong_3', 'value'=> set_value('vong_3')?set_value('vong_3'):$hoso->vong3,'maxlength'=>2,'style'=>'width:80px;display:inline-block;','required'=>'');
	$yahoo 		= array('id'=>'yahoo', 'class'=>'form-control', 'name'=>'yahoo', 'value'=> set_value('yahoo')?set_value('yahoo'):$hoso->yahoo);
	$facebook 	= array('id'=>'facebook', 'class'=>'form-control', 'name'=>'facebook', 'value'=> set_value('facebook')?set_value('facebook'):$hoso->facebook);
	$hoc_van 	= array('id'=>'hoc_van', 'class'=>'form-control', 'name'=>'hoc_van', 'value'=> set_value('hoc_van')?set_value('hoc_van'):$hoso->hoc_van);
	$ngoai_ngu 	= array('id'=>'ngoai_ngu', 'class'=>'form-control', 'name'=>'ngoai_ngu', 'value'=> set_value('ngoai_ngu')?set_value('ngoai_ngu'):$hoso->ngoai_ngu);
	$nang_khieu = array('id'=>'nang_khieu', 'class'=>'form-control', 'name'=>'nang_khieu', 'value'=> set_value('nang_khieu')?set_value('nang_khieu'):$hoso->nang_khieu);
	$kinh_nghiem = array('id'=>'kinh_nghiem', 'class'=>'form-control', 'name'=>'kinh_nghiem', 'value'=> set_value('kinh_nghiem')?set_value('kinh_nghiem'):$hoso->kinh_nghiem,'style'=>'height:100px;','cols'=>'45','rows'=>'5');
	$tgian_tu = array('id'=>'tgian_tu', 'class'=>'form-control time start', 'name'=>'tgian_tu', 'value'=> set_value('tgian_tu')?set_value('tgian_tu'):$hoso->tgian_tu);
	$tgian_den = array('id'=>'tgian_den', 'class'=>'form-control time end', 'name'=>'tgian_den', 'value'=> set_value('tgian_den')?set_value('tgian_den'):$hoso->tgian_den);
	?>
	<script type="text/javascript" src="<?=base_url('assets/js/form.js')?>"></script>
	<script language="javascript">
		$(document).ready(function(){			
			$(document).find("select.select").each(function(){			
				$(this).multiselect({
					header: false,
					noneSelectedText: $(this).attr("title"),
					selectedList: 1,
					multiple: false,
					minWidth: $(this).width()					
				});
			});
			
			$("select.multiselect").multiselect({
				header: "Chọn tối đa 10",
				noneSelectedText: $("select.multiselect").attr("title"),
				selectedList: 10,
				click: function(e){
					if( $(this).multiselect("widget").find("input:checked").length > 10 ){
						return false;
					}
				}
			});
		});
	</script>
	<form method="post" action="<?=site_url('tai-khoan');?>" role="form">		
		<div class="col-md-6">
			<div class="form-group">
				<label for="ho_ten">Họ và tên</label>					
				<?php echo form_input($ho_ten);?>
			</div>
			<table width="100%">
				<tr>
					<td class="table-control" style="width:50%;">
						<div class="form-group">
							<label for="ngay_sinh">Ngày sinh</label>
							<?php echo form_input($ngay_sinh);?>
						</div>
					</td>
					<td class="table-control" style="max-width:50%">						
						<table>
							<tr>
								<td style="width:50%;">
									<div class="form-group">							 
										<label for="gioi_tinh">Giới tính</label><br/>
										&nbsp;&nbsp;Nam <input name="gioi_tinh" type="radio" value="1" <?=set_value('gioi_tinh')?'checked':$hoso->gioi_tinh==1?'checked':''?>> 
										&nbsp;&nbsp;Nữ <input name="gioi_tinh" type="radio" value="0" <?=set_value('gioi_tinh')?'checked':$hoso->gioi_tinh==0?'checked':''?>>							
									</div>
								</td>
								<td>
									<div class="form-group">
										<label for="hon_nhan">Hôn nhân</label>
										<?php echo form_dropdown('hon_nhan',$hon_nhan,set_value('hon_nhan')?set_value('hon_nhan'):0,'class="form-control"');?>
									</div>
								</td>
							</tr>
						</table>						
					</td>
				</tr>
				<tr>
					<td>
						<div class="form-group">
							<label for="tinh_thanh">Tỉnh thành</label>
							<?php echo form_dropdown('tinh_thanh',$tinh_thanh,set_value('tinh_thanh')?set_value('tinh_thanh'):$hoso->tinh_thanh_id,'class="form-control" title="Chọn Tỉnh/Thành Phố" onchange="get_quan_huyen(this);"');?>
						</div>
					</td>
					<td>
						<div class="form-group" id="quan_huyen_wrap">
							<label for="tinh_thanh">Quận/huyện</label>
							<?php echo form_dropdown('quan_huyen',$quan_huyen,set_value('quan_huyen')?set_value('quan_huyen'):$hoso->quan_huyen_id,'class="form-control" title="Chọn quận/huyện"');?>
						</div>
					</td>
				</tr>
				<tr>
					<td class="table-control" style="width:50%">
						<table width="100%">
							<tr>
								<td class="table-control" style="width:50%">
									<div class="form-group datepairExample">
										<label class="tgian_tu">Thời gian từ</label>
										<?php echo form_input($tgian_tu);?>
									</div>
								</td>
								<td class="table-control">
									<div class="form-group datepairExample">
										<label for="tgian_den">đến</label>
										<?php echo form_input($tgian_den);?>
									</div>
								</td>
							</tr>
						</table>
						<script type="text/javascript" src="<?=base_url('assets/js/jquery.timepicker.js')?>"></script>
						<script type="text/javascript" src="<?=base_url('assets/js/datepair.js')?>"></script>
						<script type="text/javascript" src="<?=base_url('assets/js/jquery.datepair.js')?>"></script>
						<link rel="stylesheet" type="text/css" href="<?=base_url('assets/css/jquery.timepicker.css')?>"/>
						<script>
							jQuery('.datepairExample .time').timepicker({
							  'showDuration': true,
							  'timeFormat': 'H:i'				  
							});
							jQuery('.datepairExample').datepair();
						</script>
					</td>
					<td class="table-control">						
					</td>
				</tr>
				<tr>
					<td class="table-control w50">
						<div class="form-group">
							<label for="di_dong1">Di động 1</label>								
							<?php echo form_input($di_dong1);?>
						</div>
					</td>
					<td class="table-control">
						<div class="form-group">
							<label for="di_dong2">Di động 2</label>
							<?php echo form_input($di_dong2);?>
						</div>
					</td>
				</tr>
				<tr>
					<td class="table-control w50">
						<div class="form-group">
							<label for="yahoo">Nick Yahoo</label>
							<?php echo form_input($yahoo);?>
						</div>
					</td>
					<td class="table-control">
						<div class="form-group">
							<label for="facebook">Facebook</label>
							<?php echo form_input($facebook);?>
						</div>
					</td>
				</tr>
				<tr>
					<td>
						<div class="form-group">
							<label for="chieu_cao_m">Chiều cao</label>
							<?php echo form_input($chieu_cao_m);?> m
							<?php echo form_input($chieu_cao_cm);?>
						</div>						
					</td>
					<td>
						<div class="form-group">
							<label for="can_nang">Cân nặng</label>
							<?php echo form_input($can_nang);?> Kg
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="form-group">
							<label class="vong_1">Số đo 3 vòng</label>
							<?php echo form_input($vong_1);?> -
							<?php echo form_input($vong_2);?> -
							<?php echo form_input($vong_3);?>
						</div>
					</td>					
				</tr>
				<tr>
					<td>
						<div class="form-group">
							<label for="hoc_van">Trình độ học vấn</label>
							<?php echo form_input($hoc_van);?>
						</div>
					</td>
					<td>
						<div class="form-group">
							<label for="ngoai_ngu">Ngoại ngữ</label>
							<?php echo form_input($ngoai_ngu);?>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="form-group">
							<label for="nang_khieu">Năng khiếu khác</label>
							<?php echo form_input($nang_khieu);?>
						</div>
					</td>
					<td></td>
				</tr>
				<tr>
					<td colspan="2">
						<div class="form-group">
							<label for="kinh_nghiem">Kinh nghiệm làm việc</label>
							<?php echo form_textarea($kinh_nghiem);?>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2" class="text-center">
						<input type="hidden" value="hoso" name="type"> 
						<input class="btn btn-primary" type="submit" value="Cập nhật"/> 
					</td>
				</tr>
			</table>
		</div>
	</form>
	<script type="text/javascript" src="<?=base_url('assets/js/jquery.timepicker.js')?>"></script>
	<script type="text/javascript" src="<?=base_url('assets/js/datepair.js')?>"></script>
	<script type="text/javascript" src="<?=base_url('assets/js/jquery.datepair.js')?>"></script>
	<link rel="stylesheet" type="text/css" href="<?=base_url('assets/css/jquery.timepicker.css')?>"/>
	<script type="text/javascript" src="<?=base_url('assets/js/jquery.form.min.js')?>"></script>
	<script>
		 $('#datepairExample .time').timepicker({
			  'showDuration': true,
			  'timeFormat': 'H:i'				  
		 });
		 $('#datepairExample').datepair();
	</script>
	<div id="avatar" class="left">
		<p class="text-center avatar-title">Hình đại diện</p>
		<div class="text-center">
			<?php $img = base_url('assets/img/no_image.png');
				if($hoso->avatar)
					$img = base_url('uploads/images/full/'.$hoso->avatar);
			?>
			<img id="img_avatar" src="/assets/timthumb.php?w=400&src=<?=$img?>" alt="<?=$hoso->ho_ten?>"/>
			<p>&nbsp;</p>
			<div id="file-avatar">		
			</div>
			<div class="qq-upload-extra-drop-area hide">Drop files here too</div>
			<script type="text/javascript">        					        
				var ajaxuploader = new qq.FileUploader({
					element: document.getElementById('file-avatar'),
					action: "<?php echo base_url('upload/upload_files/avatar');?>",
					allowedExtensions: ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
					uploadButtonText:	'Thay đổi',
					cancelButtonText: 'Hủy tải ảnh',
					failUploadtext:	'Tải ảnh không thành công',
					dragText:			'Kéo thả ảnh vào đây để tải lên',
					debug: false,
					multiple: false,
					extraDropzones: [qq.getByClass(document, 'qq-upload-extra-drop-area')[0]],
					template:   '<div class="qq-uploader">' +
						'<div class="qq-upload-drop-area"><span>{dragText}</span></div>' +
						'<div class="qq-upload-btn btn btn-default">{uploadButtonText}</div>' +
						'<ul class="qq-upload-list"></ul>' +
						'</div>',
					fileTemplate: '<li>' +
						'<span class="qq-progress-bar"></span>' +
						'<span class="qq-upload-spinner"></span>' +
						'<span class="qq-upload-finished"></span>' +
						'<span class="qq-upload-file"></span>' +
						'<span class="qq-upload-size"></span>' +
						'<a class="qq-upload-cancel btn btn-danger" href="#">{cancelButtonText}</a>' +
						'<span class="qq-upload-failed-text alert alert-danger">{failUploadtext}</span>' +
						'</li>',
					classes: {
						// used to get elements from templates
						button: 'qq-upload-btn',
						drop: 'qq-upload-drop-area',
						dropActive: 'qq-upload-drop-area-active',
						dropDisabled: 'qq-upload-drop-area-disabled',
						list: 'qq-upload-list',
						progressBar: 'qq-progress-bar',
						file: 'qq-upload-file',
						spinner: 'qq-upload-spinner',
						finished: 'qq-upload-finished',
						size: 'qq-upload-size',
						cancel: 'qq-upload-cancel',
						// added to list item <li> when upload completes
						// used in css to hide progress spinner
						success: 'qq-upload-success',
						fail: 'qq-upload-fail',
						successIcon: null,
						failIcon: null,
					},
					showMessage: function(message){
						alert(message);
					},
					onProgress: function(id, fileName, loaded, total) {
						var progress = Math.round((loaded/total)*100);
						$('.progress .bar').css({
							'width':  progress,
						});
					},
					onError: function(id, fileName, xhr){
						
					},
					onComplete: function(id, fileName, responseJSON){
						var img = responseJSON;
						jQuery('#img_avatar').attr("src", '/assets/timthumb.php?w=400&src=/uploads/images/full/'+img.filename);
					},
				});   
			</script>
		</div>
		<form role="form" method="post" action="<?=site_url('tai-khoan')?>">
			<div class="col-md-6">
				<label style="white-space:nowrap">Email: <b><?=$user['email']?></b></label>
				<label>Mật khẩu:</label>
				<input type="password" class="form-control" id="password" name="password" placeholder="Mật khẩu">				
				<br/>
				<input type="password" class="form-control" id="repassword" name="repassword" placeholder="Nhập lại mật khẩu">
				<br/>
				<div class="col-md-12 text-center">
					<input name="type" type="hidden" value="password"/>
					<input class="btn btn-primary" type="submit" value="Đổi mật khẩu" onclick="check_password(event)"/>
				</div>
			</div>
			<div class="col-md-6"></div>			
		</form>
	</div>
<?php elseif($user['loai'] == 2):
	$ten 		= array('id'=>'ten', 'class'=>'form-control', 'name'=>'ten', 'value'=> set_value('ten')?set_value('ten'):$hoso->ten,'type'=>'text','required'=>'');
	$gioi_thieu 	= array('id'=>'gioi_thieu', 'class'=>'form-control', 'name'=>'gioi_thieu', 'value'=> set_value('gioi_thieu')?set_value('gioi_thieu'):$hoso->gioi_thieu, 'rows'=>5);
	$nguoi_lien_he 	= array('id'=>'nguoi_lien_he', 'class'=>'form-control', 'name'=>'nguoi_lien_he', 'value'=> set_value('nguoi_lien_he')?set_value('nguoi_lien_he'):$hoso->nguoi_lien_he);
	$dia_chi 	= array('id'=>'dia_chi', 'class'=>'form-control', 'name'=>'dia_chi', 'value'=> set_value('dia_chi')?set_value('dia_chi'):$hoso->dia_chi);	
	$dien_thoai 	= array('id'=>'dien_thoai', 'class'=>'form-control', 'name'=>'dien_thoai', 'value'=> set_value('dien_thoai')?set_value('dien_thoai'):$hoso->dien_thoai);
	$di_dong 	= array('id'=>'di_dong', 'class'=>'form-control', 'name'=>'di_dong', 'value'=> set_value('di_dong')?set_value('di_dong'):$hoso->di_dong);
?>
	<form id="contact_form" method="post" action="<?=site_url('tai-khoan');?>" role="form">
		<div class="col-md-6">
			<div class="form-group">
				<label for="ten">Tên</label>
				<?php echo form_input($ten);?>
			</div>
			<div class="form-group">
				<label for="file-uploader">Logo</label>
				<div  class="text-center" id="img0">
				<?php $avatar = '/assets/img/no_logo.png';
					if($hoso->avatar)
						$avatar = '/uploads/images/full/'.$hoso->avatar;
				?>
					<img id="img_avatar" class="img-thumbnail" src="/assets/timthumb.php?w=200&src=<?=$avatar?>" alt="<?=$hoso->ten?>"/>
					<p>&nbsp;</p>
					<div id="file-uploader"></div>
					<script type="text/javascript">        
						new qq.FileUploader({
							element: document.getElementById('file-uploader'),
							action: "<?php echo base_url('upload/upload_files/avatar');?>",
							allowedExtensions: ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
							multiple	: false,
							debug: false,
							template:   '<div class="qq-uploader">' +
								'<div class="qq-upload-drop-area"><span>{dragText}</span></div>' +
								'<div class="qq-upload-btn text-center"><input type="button" name="btn_image" value="Chọn hình" alt="image" title="Hình Đại Diện" class="btn btn-default"></div>' +
								'<ul class="qq-upload-list"></ul>' +
								'</div>',
							fileTemplate: '<li class="avatar">' +
								'<span class="avatar qq-progress-bar"></span>' +
								'<span class="qq-upload-spinner"></span>' +
								'<span class="avatar qq-upload-finished"></span>' +
								'<span class="avatar qq-upload-file"></span>' +
								'<span class="avatar qq-upload-size"></span>' +
								'<a class="avatar qq-upload-cancel btn btn-danger" href="#">{cancelButtonText}</a>' +
								'<span class="avatar qq-upload-failed-text alert alert-danger">{failUploadtext}</span>' +
								'</li>',
							classes: {
								// used to get elements from templates
								button: 'qq-upload-btn',
								list: 'qq-upload-list',
								drop: 'qq-upload-drop-area',
								progressBar: 'qq-progress-bar',
								file: 'qq-upload-file',
								spinner: 'qq-upload-spinner',
								finished: 'qq-upload-finished',
								size: 'qq-upload-size',
								cancel: 'qq-upload-cancel',
								// added to list item <li> when upload completes
								// used in css to hide progress spinner
								success: 'qq-upload-success',
								fail: 'qq-upload-fail',
								successIcon: null,
								failIcon: null,
							},
							showMessage: function(message){
								alert(message);
							},
							onError: function(id, fileName, xhr){
								console.log(xhr);
							},
							onComplete: function(id, fileName, responseJSON){
								var img = responseJSON;
								jQuery('#img_avatar').attr("src", '/assets/timthumb.php?w=200&src=/uploads/images/full/'+img.filename);
							},
						});
					</script>
				</div>
			</div>
			<div class="form-group">
				<label for="gioi_thieu">Giới thiệu</label>
				<?php echo form_textarea($gioi_thieu);?>					
			</div>
			<div class="form-group">
				<label for="nguoi_lien_he">Người liên hệ</label>
				<?php echo form_input($nguoi_lien_he);?>					
			</div>
			<div class="form-group">
				<label for="dia_chi">Địa chỉ</label>
				<?php echo form_input($dia_chi);?>
			</div>
			<div class="form-group">
				<label for="dien_thoai">Điện thoại:</label>
				<?php echo form_input($dien_thoai);?>
			</div>
			<div class="form-group">
				<label for="di_dong">Di động:</label>
				<?php echo form_input($di_dong);?>
			</div>
			<div class="text-center">
				<input type="hidden" value="hoso" name="type"> 
				<input class="btn btn-primary" type="submit" value="Cập nhật"/> 
			</div>
		</div>
   </form>
<?php else :?>
<?php endif;?>